const http = require('http')

const server = http.createServer((req, res) => {
    res.setHeader('Access-Control-Allow-Origin', '*')  // 设置响应头允许谁访问后端，*代表所有，* 换成其他，可以设置具体的域名
    res.setHeader('Access-Control-Allow-Headers', '*')
    res.setHeader('Access-Control-Allow-Methods', '*')
    res.end('hello')

})

server.listen(8080, () => {
    console.log('server is running') 
})